import request from '@/utils/request'

export function create(tableName) {
  return request({
    url: '/generator/create/' + tableName,
    method: 'post'
  })
}

export function preview(tableName) {
  return request({
    url: '/generator/preview/' + tableName,
    method: 'get'
  })
}

export function download(tableName) {
  return request({
    url: '/generator/download/' + tableName,
    method: 'post',
    responseType: 'blob'
  })
}

export function addConfig(data) {
  return request({
    url: '/generator/config/',
    method: 'post',
    data
  })
}

export function getConfig(tableName) {
  return request({
    url: '/generator/config/' + tableName,
    method: 'get'
  })
}

export default { create, preview, download, addConfig, getConfig }
